package homework;
class User {
    // 创建类的成员变量
    private String Username;
    private String Password;
    private String Email;
    // 构造函数，邮箱是可选的
    public User(String username, String password, String email) {
        this.Username = username;
        this.Password = password;
        this.Email = email != null ? email : "";  // 如果邮箱为 null，设置为空字符串
    }
    // 展示用户信息
    public void userInfo() {
        System.out.println("username: " + Username);
        System.out.println("password: " + Password);
        if (!Email.isEmpty()) {
            System.out.println("email: " + Email);
        }
    }
}
public class us {
    public static void main(String[] args) {
        // 创建用户对象，展示有邮箱和没有邮箱的情况
        User user1 = new User("myantion", "neco111", "92802@gmail.com");
        user1.userInfo();
        User user2 = new User("ayachi", "onanii0721", "");
        user2.userInfo();
    }
}
